package August;

import java.util.List;
import java.util.Scanner;

public class Day0805 {
    /**
     * 年终奖
     * @param board
     * @return
     */
    public int getMost(int[][] board){
       int r = board.length;
       int c = board[0].length;

       //初始化
        for (int i = 1; i < c; i++) {
            board[0][i] += board[0][i-1];
        }
        for (int i = 1; i < r; i++) {
            board[i][0] += board[i-1][0];
        }

        for (int i = 1; i < r ; i++) {
            for (int j = 1; j < c; j++) {
                board[i][j] += Math.max(board[i-1][j] , board[i][j-1]);
            }
        }
        return board[r-1][c-1];
    }


    /**
     * 迷宫问题
     * @param args
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int n = scanner.nextInt();
            int m = scanner.nextInt();
            int[][] nums = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    nums[i][j] = scanner.nextInt();
                }
            }

            //处理数据
        }
    }
}
